using System;
using System.Collections.Generic;
using System.Text;
using MyPhotoIndex.Interfaces;

namespace MyPhotoIndex.Utilities
{
    public class LocalizedResourceManager : Singleton<LocalizedResourceManager>
    {
        private Dictionary<string, TranslatedResourceString> m_strings = new Dictionary<string, TranslatedResourceString>();
        private List<TranslatedResourceString> m_stringList = new List<TranslatedResourceString>();

        internal string GetString(string parent, Type type, string objectName)
        {
            TranslatedResourceString trs = null;
            if (m_strings.TryGetValue(String.Format("{0}.{1}.{2}", parent, type.Name, objectName), out trs) == true)
            {
                return trs.Value;
            }

            return String.Empty;
        }

        internal void AddString(string parent, Type type, string objectName, string value)
        {
            TranslatedResourceString trs = new TranslatedResourceString(parent, type.Name, objectName, value);
            m_strings.Add(trs.ToString(), trs);
            m_stringList.Add(trs);
            System.Diagnostics.Debug.WriteLine(trs);
        }
    }
}
